﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using SpaceNeedle.x6473.WindowsPhone.ViewModels;
using SpaceNeedle.x6473.WindowsPhone.Common;
using Windows.Networking.Connectivity;
using SpaceNeedle.SDK.WindowsPhone.Views;
using Microsoft.Phone.Tasks;

namespace SpaceNeedle.x6473.WindowsPhone.Views
{
    public class FacebookPostDetailView : ViewBase<FacebookPostDetailViewModel> { }

    public partial class FacebookPostDetail : FacebookPostDetailView
    {
        public FacebookPostDetail()
        {
            InitializeComponent();
        }

        private void OnShareAppBarButton_Click(object sender, EventArgs e)
        {
            string content = AppViewModel.Instance.Properties.SelectedPost.Text;
            string uri = this.ViewModel.AppContent.About.AboutShareButtonUri;

            ShareLinkTask shareLinkTask = new ShareLinkTask();

            shareLinkTask.Title = "Compartilhe";
            shareLinkTask.LinkUri = new Uri(uri, UriKind.Absolute);
            shareLinkTask.Message = content;

            shareLinkTask.Show();

            Tracking.SendSocial("WP8", "share facebook post", uri);

        }

        private void OnUploadsMenuItem_Click(object sender, EventArgs e)
        {
            this.ViewModel.UploadsCommand.Execute(null);
        }

        private void OnAboutMenuItem_Click(object sender, EventArgs e)
        {
            this.ViewModel.AboutCommand.Execute(null);
        }

        private void OnSignOutMenuItem_Click(object sender, EventArgs e)
        {
            this.ViewModel.SignOutCommand.Execute(null);
        }
    }
}